// pages/distribution/commission.js

const app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        wx.showLoading({
            title: '加载中...',
        })
        Promise.all([
            app.http.post('distributor/commission-count'),
            app.http.post('distributor/set'),
        ]).then(res => {
            res[0].data.txCondition = parseFloat(res[0].data.couldCash) >= parseFloat(res[1].data.mix_money)
            this.setData(Object.assign(res[0].data, res[1].data))
            wx.hideLoading()
        }).catch(err => {
            app.wxToast.error(err.message)
        })
    },

    tx() {
        wx.redirectTo({
            url: '/pages/distribution/put-money',
        })
    }
})